<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" aria-labelledby="createOrEditModal" class="modal fade"
    tabindex="-1" role="dialog" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <form *ngIf="active" #MetaphysicsTypeForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="metaType?.id">{{l("EditNewCate")}}: {{metaType?.id+' | '+metaType?.name}}</span>
                        <span *ngIf="!metaType.id">{{l("CreateNewCate")}}</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" aria-label="Close">
                        <i aria-hidden="true" class="ki ki-close"></i>
                      </button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-12">
                            <div class="form-group">
                                <label>{{l("Name")}} *</label>
                                <input #nameInput="ngModel" class="form-control" type="text" name="Name" [(ngModel)]="metaType.name"
                                    required maxlength="32">
                                <validation-messages [formCtrl]="nameInput"></validation-messages>
                            </div>

                            <div class="form-group kt-form__group align-items-center">
                                <label>{{l('TenantSelection')}}</label>
                                <div class="input-group">
                                    <select class="form-control" [(ngModel)]="metaType.tenantId" name="tenantId">
                                        <option value="">{{l("HOST")}}</option>
                                        <option *ngFor="let tenant of tenantList" [value]="tenant.id">{{tenant.name+'('+tenant.tenancyName+')'}}</option>
                                    </select>
                                </div>
                            </div>


                            <div class="form-group kt-form__group align-items-center">
                                <label>{{l('QuestionType')}}</label>
                                <div class="input-group">
                                    <select class="form-control" [(ngModel)]="categoryId" name="categoryId"
                                        [disabled]="!categorys">
                                        <option value="">{{l("None")}}</option>
                                        <option *ngFor="let category of categorys" [value]="category.id">{{category.name}}</option>
                                    </select>
                                </div>
                            </div>


                            <div class="form-group">
                                <label>{{l("detail")}}</label>
                                <textarea #descriptionInput="ngModel" class="form-control" name="operations"
                                    [(ngModel)]="metaType.operations" maxlength="500" required></textarea>
                                <validation-messages [formCtrl]="descriptionInput"></validation-messages>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-primary" (click)="close()">{{l("Cancel")}}</button>
                    <button type="submit" class="btn btn-primary blue" [disabled]="!MetaphysicsTypeForm.form.valid"
                        [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{l("Save")}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>